package com.p2p.base.email;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.apache.commons.mail.EmailAttachment;
import org.apache.commons.mail.EmailException;

/**
 * 发送Html格式，不带附件的邮件。
 * 
 * @author leiwen@fansunion.cn
 * 
 *         小雷团队：http://FansUnion.cn
 * 
 *         QQ:240-370-818
 */
public class SendHtmlEmail {

	public static void main(String[] args) throws EmailException {
		testHtmlEmail();
	}

	public static void testHtmlEmail() throws EmailException {
		//邮件类型，true表示Html邮件，false表示纯文本邮件
		EmailSender emailSender = new EmailSender(true);

		// 接收者邮箱
		String subject = "发邮件测试";
		String content = "test邮件";

		String to = "240370818@qq.com";
		List<String> list = new ArrayList<String>();
		list.add(to);
		EmailAttachment attachment = new EmailAttachment();
		attachment.setPath("c://test.pdf");
		emailSender.sendEmail(list, subject, content,Arrays.asList(attachment));

	}
}
